package com.example.aspectj;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.example.aspectj.annotation.ClickBehavior;
import com.example.aspectj.annotation.LoginCheck;

public class MainActivity extends AppCompatActivity {

    private static final String TAG = MainActivity.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    // 都需要做用户行为统计
    @ClickBehavior(value = "登录")
    public void login(View view) {
        Log.e(TAG, "login: 验证通过，登录成功");
    }

    //登录成功之后 用户行为统计
    @ClickBehavior(value = "我的专区")
    @LoginCheck()
    public void area(View view) {
        Log.e(TAG, "area: 跳转我的专区");
        startActivity(new Intent(MainActivity.this, OtherActivity.class));
    }

    //登录成功之后 用户行为统计
    @ClickBehavior(value = "我的优惠券")
    @LoginCheck()
    public void coupon(View view) {
        Log.e(TAG, "coupon: 跳转我的优惠券");
        startActivity(new Intent(MainActivity.this, OtherActivity.class));
    }

    //登录成功之后 用户行为统计
    @ClickBehavior(value = "我的积分")
    @LoginCheck()
    public void score(View view) {
        Log.e(TAG, "score: 跳转我的积分");
        startActivity(new Intent(MainActivity.this, OtherActivity.class));
    }
}
